package malloc;
//一维数组的动态和
public class basic1480 {

    public int[] runningSum(int[] nums) {
        int[] newarr = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j <=i ; j++) {
                newarr[i]+=nums[j];

            }
        }
        return  newarr;


    }

    public static void main(String[] args) {
        basic1480 basic1480 = new basic1480();
        int[] ints = basic1480.runningSum(new int[]{1, 2, 3, 4, 5});
        for (int a :
                ints) {
            System.out.println(a);
        }
    }

}
